package com.software_product_construction.backend_software_product_construction.util;

import org.junit.Test;

import java.text.SimpleDateFormat;


public class DateUtil {
    public static final String FORMAT_YYYY_MM_dd = "YYYY-MM-dd";
    public static final String FORMAT_YYYY_MM_dd_HH_mm = "YYYY-MM-dd HH:mm";
    public static final String FORMAT_YYYY_MM_dd_hh_mm = "YYYY-MM-dd hh:mm";
    public static final String FORMAT_YYYY_MM_dd_HH_mm_ss = "YYYY-MM-dd HH:mm:ss";
    public static final String FORMAT_YYYY_MM_dd_hh_mm_ss = "YYYY-MM-dd hh:mm:ss";
    public static synchronized String getDate(String format){
        long l = System.currentTimeMillis();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
        String _format = simpleDateFormat.format(l);
        return _format;
    }

    public static synchronized String getDate(String format, long timeStrap){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
        String _format = simpleDateFormat.format(timeStrap);
        return _format;
    }



    @Test
    public void testDate(){
        System.out.println(getDate(FORMAT_YYYY_MM_dd));
    }
}
